<?#//v.3.1.1
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";

#//
unset($ERR);

#//
if($_POST[action] == "update" && phpa_securepost($_POST))
{
	#// Data check
	if(empty($_POST[sitename]) ||
	empty($_POST[siteurl]) ||
	empty($_POST[adminmail]))
	{
		$ERR = $ERR_047;
		$SETTINGS = $_POST;
	}
	else
	{
		#// Update data
		$query = "update PHPAUCTIONXL_settings set
			sitename='".addslashes($_POST[sitename])."',
			adminmail='".addslashes($_POST[adminmail])."',
			siteurl='".addslashes($_POST[siteurl])."'";
		$res = mysql_query($query);
		if(!$res)
		{
			print "Error: $query<BR>".mysql_error();
			exit;
		}
		else
		{
			$ERR = $MSG_542;
			$SETTINGS = $_POST;
		}
	}
}
else
{
	#//
	$query = "SELECT siteurl,adminmail,sitename FROM PHPAUCTIONXL_settings";
	$res = @mysql_query($query);
	if(!$res)
	{
		print "Error: $query<BR>".mysql_error();
		exit;
	}
	elseif(mysql_num_rows($res) > 0)
	{
		$SETTINGS = mysql_fetch_array($res);
	}
}

?>
<HTML>
<HEAD>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</HEAD>
<bodyleftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/settings_icon2.gif" width="30" height="29"></td>
          <td  class="breadcrumbs"><p><span><?=$MSG_25_0007?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_526?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">
		<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0 BGCOLOR="#FFFFFF">
		<TR>
		<TD align="center">
			<BR>
			<FORM NAME=conf ACTION=<?=basename($_SERVER['SCRIPT_NAME'])?> METHOD=POST >
				<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0" class="base" style="border:1px solid #ccc;">
					<TR>
						<TD ALIGN=CENTER class=title>
						<p>	<? print $MSG_526; ?></p>
						</TD>
					</TR>
					<TR>
						<TD>
		
			<TABLE WIDTH=100% ALIGN="CENTER" CELLPADDING=0 cellspacing="0" BGCOLOR="#FFFFFF">
			<?
			if(isset($ERR))
			{
			?>
				<TR BGCOLOR=yellow>
				<TD COLSPAN="2" class="error"><p>
				  <? print $ERR; ?>
				  </p></TD>
			  </TR>
			 <?
			}
			 ?>
			 
			  <TR VALIGN="TOP">
				<TD WIDTH=125 class="lineV">
				  <p class="blue"><? print $MSG_527; ?></p>
				  </TD>
				<TD WIDTH="365"> 
				  <p><? print $MSG_535; ?></p>
				  
				  <INPUT TYPE="text" NAME="sitename" SIZE="45" MAXLENGTH="255" VALUE="<?=stripslashes($SETTINGS[sitename])?>">
				</TD>
			  </TR>
			 
			  <TR VALIGN="TOP">
				<TD WIDTH=125 class="lineV gris">
				 <p class="blue"> <? print $MSG_528; ?></p>
				  </TD>
				<TD WIDTH="365" class="gris"> 
				<p>  <? print $MSG_536; ?></p>
				 
				  <INPUT TYPE="text" NAME="siteurl" SIZE="45" MAXLENGTH="255" VALUE="<?=$SETTINGS[siteurl]?>">
				</TD>
			  </TR>
			 
			  <TR VALIGN="TOP">
				<TD WIDTH=125 class="lineV">
				<p class="blue">  <? print $MSG_540; ?></p>
				  </TD>
				<TD WIDTH="365"> &nbsp;
				   
				  <p><? print $MSG_541; ?></p>
				  
				  <INPUT TYPE="text" NAME="adminmail" SIZE="45" MAXLENGTH="100" VALUE="<?=$SETTINGS[adminmail]?>">
				  &nbsp;
				   &nbsp;
				  </TD>
			  </TR>
			 
			  <TR>
				<TD WIDTH=125 class="lineV">
				  <INPUT TYPE="hidden" NAME="action" VALUE="update" /> <INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />
				</TD>
				<TD WIDTH="365">
				  <INPUT TYPE="submit" NAME="act" VALUE="<? print $MSG_530; ?>" class="action">
				</TD>
			  </TR>
			  <TR>
				<TD WIDTH=125></TD>
				<TD WIDTH="365"> </TD>
			  </TR>
			</TABLE>
						</TD>
					</TR>
				</TABLE>
			</FORM>
		</TD>
		</TR>
		</TABLE>
	</TD>
	</TR>
	</TABLE>
</BODY>
</HTML>
